import axios from "axios";
import { Dispatch } from "redux";
export let getlist = () => {
  return async (dispatch: Dispatch) => {
    let { data } = await axios.get("/api/list");
    // console.log(data);

    dispatch({
      type: "GET_LIST",
      payload: data.list,
    });
  };
};
export let add_list = (values: any) => {
  return {
    type: "ADD_LIST",
    payload: values,
  };
};
export let sub_list = (id: number) => {
  return {
    type: "SUB_LIST",
    payload: id,
  };
};
export let search = (e: string) => {
  return {
    type: "SEARCH",
    payload: e,
  };
};
